<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>title</title>
      <link rel="stylesheet" type="text/css" href="../css/api.css"/>
      <style>
      *{
  margin: 0;
  height: 0;
}
body{
  width: 100%;
  height: 100%;
  padding-top: 1.7rem;
}
.header{
      width: 93%;
      height: 2.5rem;
      line-height: 2.5rem;
      padding: 0.5rem 0.8rem;
      text-align: center;
      position: fixed;
      top:1.5rem;
      background-color: #40cccc;
      z-index: 999;
  }
.header_img{
  width: 6%;
  height: 45%;
  float: left;
  margin-top: 0.4rem;
}
.header_img img{
  width: 100%;
  height: 100%;
}
.header h3{
  line-height: 3rem;
  width: 90%;
  margin-left: 0.7rem;
  text-align: center;
  color: #fff;
}
.table{
  width: 90%;
  height: auto;
  border: 0.1rem solid #ccc;
  margin: 4rem auto 0rem;
}
.tr th{
  padding: 0.5rem;
}
.nav{
  font-size: 0.9rem;

  text-align: center;
}
.nav td{
    padding: 0.3rem;
}
      </style>
  </head>
  <body>
    <div class="header">
      <div class="header_img">
        <img src="../image/u18.png" alt="" onclick="closewin()">
      </div>
      <h3>作业列表</h3>
    </div>
    <table border="1" class="table" id="zylist">


    </tr>

</table>
  </body>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/common.js"></script>
  <script type="text/javascript" src="../script/jquery-1.8.3.js"></script>
  <script type="text/javascript">
  var id
      apiready = function(){
        id = api.pageParam.id
        api.addEventListener({
            name:'pyzy',
            extra:{
                threshold:0
            }
        }, function(ret, err){
        //  userinfo = $api.getStorage('userinfo');
          get_zylist()
        });
        get_zylist()
      };

      function get_zylist() {
        var html =''
        var obj = $api.byId('zylist');

        api.ajax({
            url: SITE_URL+'livebr/cur/zylb',
            method: 'post',
            data: {
                values: {
                    id: id
                }
            }
        },function(ret, err){
            if (ret) {
              if(ret.error==200){
                if(ret.data.length>0){
                  html +='<tr class="tr">'
                  html +='<th>名称</th>'
                  html +='<th>时间</th>'
                  html +='<th>操作</th>'
                  html +='</tr>'
                  for (var i = 0; i < ret.data.length; i++) {
                    var dat = ret.data[i]
                    html +='<tr class="nav">'
                    html +='<td>'+dat.nick_name+'</td>'
                    html +='<td>'+dat.time+'</td>'
                    if(dat.status==1){
                      html +='<td>已批阅</td>'
                    }else{
                      html +='<td onclick="py('+dat.id+')">批阅</td>'
                    }
                    html +='</tr>'
                  }
                  $api.html(obj, html);
                }
              }else{
                msgcode('暂无用户提交作业')
              }
                //alert( JSON.stringify( ret ) );
            } else {
              msgcode('请检查网络连接')
                //alert( JSON.stringify( err ) );
            }
        });

      }

      function py(id) {
        api.openWin({
            name: 'pyzy',
            url: './pyzy.html',
            pageParam: {
                id: id,

            }
        });
      }
  </script>
  </html>
